package com.itheima.controller;

import com.itheima.model.User;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/user-save")
    @ResponseBody
    public User save(){
        userService.save();
        return creatUser();
    }

    private User creatUser(){
        User user=new User();
        user.setName("hello word");
        return user;
    }
}
